<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/5/20
  Time: 19:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-3.4.1.min.js"></script>
</head>
<body>

<form action="/emp/addEmp" method="post">
    <table>
        <tr>
            <td>用户名</td>
            <td><input type="text" name="ename"></td>
        </tr>
        <tr>
            <td>用户性别</td>
            <td>
                <input type="radio" name="esex" value="男" checked> 男
                <input type="radio" name="esex" value="女"> 女
            </td>
        </tr>
        <tr>
            <td>用户工资</td>
            <td><input type="number" name="salary"></td>
        </tr>
        <tr>
            <td>用户密码</td>
            <td><input type="password" name="pwd"></td>
        </tr>
        <tr>
            <td>用户部门编号</td>
            <td><input type="number" name="dno"></td>
        </tr>
        <tr>
            <td>用户出生日期</td>
            <td><input type="date" name="bornDate"></td>
        </tr>
        <tr>
            <td align="center" colspan="2">
                <input type="submit" value="确认"><input type="reset" value="取消">
            </td>
        </tr>
    </table>
</form>

<script>
    $(function(){
        $.post("/dept/getDeptList",function(data){

            for (var i = 0; i < data.length; i++) {
                $("#dno").append("<option value='"+data[i].dno+"'>"+data[i].dname+"</option>");
            }

        });
    })
</script>

</body>
</html>
